]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
telepathyClient: Add support for aliases on the self-contact
authorJasper St. Pierre <jstpierre@mecheye.net>
Sat, 26 Feb 2011 14:25:11 +0000 (09:25 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 14 Mar 2011 22:48:18 +0000 (18:48 -0400)
Upgrade the connection's self contact to allow aliases, so that we
don't show the internal telepathy identifier anywhere user-visible.

https://bugzilla.gnome.org/show_bug.cgi?id=642793

js/ui/telepathyClient.js

index 4056679d901ef6c9ec0d83ee2883139bdc49e210..89a1861b1b782fccd6702d49a96bbcd83a355e3f 100644 (file)
@@ -68,7 +68,22 @@ Client.prototype = {
 
     _observeChannels: function(observer, account, conn, channels,
                                dispatchOp, requests, context) {
-        let connPath = conn.get_object_path();
+        // If the self_contact doesn't have the ALIAS, make sure
+        // to fetch it before trying to grab the channels.
+        let self_contact = conn.get_self_contact();
+        if (self_contact.has_feature(Tp.ContactFeature.ALIAS)) {
+            this._finishObserveChannels(account, conn, channels, context);
+        } else {
+            Shell.get_self_contact_features(conn,
+                                            contactFeatures.length, contactFeatures,
+                                            Lang.bind(this, function() {
+                                                this._finishObserveChannels(account, conn, channels, context);
+                                            }));
+            context.delay();
+        }
+    },
+
+    _finishObserveChannels: function(account, conn, channels, context) {
         let len = channels.length;
         for (let i = 0; i < len; i++) {
             let channel = channels[i];
@@ -91,7 +106,6 @@ Client.prototype = {
                     }), null);
         }
 
-        // Allow dbus method to return
         context.accept();
     },